﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BLL;
using Public;

namespace QLNhanKhau
{
    public partial class frmChiTietKhaiTu : Form
    {
        int _MaNK;
        public frmChiTietKhaiTu()
        {
            InitializeComponent();
        }
        public frmChiTietKhaiTu(int MaNK)
        {
            InitializeComponent();
            this._MaNK = MaNK;
        }

        private void frmChiTietKhaiTu_Load(object sender, EventArgs e)
        {
            NhanKhauPublic nk = NhanKhauBLL.LoadNhanKhauByMaNK(_MaNK);
            ThietLapPublic tl = ThietLapBLL.LoadThietLap();
            txtHoTen.Text = nk.HoTen;
            if (nk.GioiTinh == true)
                sbtGioiTinh.Value = true;
            else
                sbtGioiTinh.Value = false;
            
            dateNgaySinh.Value = (DateTime)nk.NgaySinh;
            txtDanToc.Text = DanTocBLL.LoadDanTocByMaDT(nk.MaDT).TenDanToc;
            txtQuocTich.Text = QuocTichBLL.LoadQuocTichByMaQT(nk.MaQT).TenQuocTich;
            txtCMND.Text = nk.CMND;
            KhaiTuPublic kt = KhaiTuBLL.LoadKhaiTuByMaKT(_MaNK, tl.TenServer, tl.TenData);

            txtSoBaoTu.Text = kt.SoBaoTu.ToString();
            txtSoChungTu.Text = kt.SoChungTu.ToString();
            txtNoiCapBaoTu.Text = kt.NoiCapBaoTu;
            txtNoiChet.Text = kt.NoiChet;
            txtNoiOCuoiCung.Text = kt.NoiOCuoiCung;
            txtNoiCap.Text = ThietLapBLL.LoadDiaChiByMaDiaChi(kt.NoiCap);
            dateNgayChet.Value = (DateTime)kt.NgayChet;
            txtNguoiCap.Text = NguoiDungBLL.LoadNguoiDungByMaND(kt.NguoiCap).HoTen;
            txtNguoiDangki.Text = kt.NguoiDangKi;
            dateNgayCapBaoTu.Value = kt.NgayCapBaoTu.Value;
            txtCanBoHoTich.Text = NguoiDungBLL.LoadNguoiDungByMaND(kt.CanBoHoTich).HoTen;      
            txtChucVuKT.Text = ChucVuBLL.LoadChucVuByMaCV(kt.ChucVu).TenChucVu;
            dateNgayCap.Value = (DateTime)kt.NgayCap;     
            txtLyDoChet.Text = kt.LyDoChet;
            
        }

        private void btnXong_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
